﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FinanceTool.WinAppUI.Utilities
{
    internal class MethodHelper
    {
        public static bool TryExecute(Action @try, Action @catch, bool throwException = false)
        {
            try
            {
                @try();
                return true;
            }
            catch(Exception ex)
            {
                Logger.LogException(ex);
                @catch();
                if (throwException) throw ex;
                return false;
            }
        }
    }
}
